menu: Clip children to view window
authorBenjamin Otte <otte@redhat.com>
Thu, 24 Mar 2016 18:50:45 +0000 (19:50 +0100)
committerLapo Calamandrei <calamandrei@gmail.com>
Thu, 24 Mar 2016 19:25:49 +0000 (20:25 +0100)
Don't overdraw the arrow allocations.

https://bugzilla.gnome.org/show_bug.cgi?id=764118

gtk/gtkmenu.c

index cdf2aecb2e6a4f8135b6acc0e118583fe71a5dbd..a811a234e6d7e9772e579511b437fc5528ca1fe1 100644 (file)
@@ -3011,7 +3011,19 @@ gtk_menu_draw (GtkWidget *widget,
         gtk_css_gadget_draw (priv->bottom_arrow_gadget, cr);
     }
 
-  GTK_WIDGET_CLASS (gtk_menu_parent_class)->draw (widget, cr);
+  if (gtk_cairo_should_draw_window (cr, priv->bin_window))
+    {
+      int x, y;
+
+      gdk_window_get_position (priv->view_window, &x, &y);
+      cairo_rectangle (cr,
+                       x, y,
+                       gdk_window_get_width (priv->view_window),
+                       gdk_window_get_height (priv->view_window));
+      cairo_clip (cr);
+
+      GTK_WIDGET_CLASS (gtk_menu_parent_class)->draw (widget, cr);
+    }
 
   return FALSE;
 }